admin: Use linkcopy_sync_data() for initramfs instead of rename()
authorColin Walters <walters@verbum.org>
Mon, 15 Apr 2013 16:50:58 +0000 (12:50 -0400)
committerColin Walters <walters@verbum.org>
Mon, 15 Apr 2013 16:50:58 +0000 (12:50 -0400)
It's possible (likely even) that /tmp is on a separate filesystem; in
that case, a raw rename() is going to fail.

Saw this on the ostree.gnome.org builder.

src/ostree/ot-admin-builtin-update-kernel.c

index a6546c23fbc71798f283f28098e12049f4b57913..fe4de9827357d84915736303f155b8f8435f544f 100644 (file)
@@ -175,10 +175,11 @@ generate_initramfs (OtAdminUpdateKernel  *self,
           goto out;
         }
 
-      if (!gs_file_rename (initramfs_tmp_file, ret_initramfs_path,
-                           cancellable, error))
+      if (!gs_file_linkcopy_sync_data (initramfs_tmp_file, ret_initramfs_path,
+                                       G_FILE_COPY_OVERWRITE,
+                                       cancellable, error))
         goto out;
-
+      
       if (!gs_shutil_rm_rf (tmpdir, cancellable, error))
         goto out;